
<?php
    $cs = Yii::app()->getClientScript();
    $cs->registerScriptFile('/scripts/ckeditor/ckeditor.js');
    $cs->registerScriptFile('/scripts/ckeditor/ckfinder/ckfinder.js');

$kind_id = CMap::mergeArray(array(
	array()),
		CHtml::listData($kinds, 'id', 'name'
	)
);


 ?>

<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'product-form',
	'enableAjaxValidation'=>false,
	'htmlOptions'=>array(
        'enctype'=>'multipart/form-data'
    )
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>

	<div class="row">
		<?php echo $form->labelEx($model,'kind_id'); ?>
		<?php #echo $form->textField($model,'kind_id',array('size'=>11,'maxlength'=>11)); ?>
		<?php echo $form->dropDownList($model,'kind_id',$kind_id); ?>
		<?php echo $form->error($model,'kind_id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'url_key'); ?>
		<?php echo $form->textField($model,'url_key',array('class'=>'span8')); ?>
		<?php echo $form->error($model,'url_key'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'name'); ?>
		<?php echo $form->textField($model,'name',array('class'=>'span8')); ?>
		<?php echo $form->error($model,'name'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'title'); ?>
		<?php echo $form->textField($model,'title',array('class'=>'span8')); ?>
		<?php echo $form->error($model,'title'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'desc'); ?>
		<?php echo $form->textArea($model,'desc',array('class'=>'span8')); ?>
		<?php echo $form->error($model,'desc'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'origin'); ?>
		<?php echo $form->textField($model,'origin',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'origin'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'material'); ?>
		<?php echo $form->textField($model,'material',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'material'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'cost'); ?>
		<?php echo $form->textField($model,'cost',array('size'=>60,'maxlength'=>255)); ?>
		<?php echo $form->error($model,'cost'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'img_id'); ?>
		<?php echo $form->textField($model,'img_id',array('size'=>11,'maxlength'=>11)); ?>
		<?php echo $form->error($model,'img_id'); ?>
	</div>

	<div class="row">
		<label>Images</label>
		<input type="file" name="image" id="input_image">
	</div>

	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->

<script language="JavaScript">
CKEDITOR.replace( 'Product[desc]',
{
    filebrowserBrowseUrl : '/scripts/ckeditor/ckfinder/ckfinder.html',
    filebrowserImageBrowseUrl : '/scripts/ckeditor/ckfinder/ckfinder.html?type=Images',
    filebrowserFlashBrowseUrl : '/scripts/ckeditor/ckfinder/ckfinder.html?type=Flash',
    filebrowserUploadUrl : '/scripts/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files',
    filebrowserImageUploadUrl : '/scripts/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images',
    filebrowserFlashUploadUrl : '/scripts/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash'
}

);

</script>
